#!/bin/bash
#quanleilei@gmail.com

if [[ "$(whoami)" != "root" ]]; then
	echo "please run this script as root ." >&2
	exit 1
fi

echo -e "\033[31m 这个是centos7系统初始化脚本，获取更多工具及脚本请关注公众号： 磊哥的IT Stack  Please continue to enter or ctrl+C to cancel \033[0m"
sleep 5

#install docker
install_docker() {
	yum -y install yum-utils device-mapper-persistent-data lvm2
	yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
	yum-config-manager --enable docker-ce-edge
	yum-config-manager --enable docker-ce-test
	yum-config-manager --disable docker-ce-edge
	yum -y install docker-ce
	yes | cp -rf ./daemon.json /etc/docker
	systemctl start docker
	systemctl enable docker
	echo "docker install succeed!!"
}

#install_docker_compace
install_docker_compace() {
	yes | cp -rf ./docker-compose /usr/local/sbin
	chmod +x /usr/local/sbin/docker-compose 
	docker-compose --version
	echo "docker-compose install succeed!!"
}

main(){
  install_docker
  install_docker_compace
}

main